﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace EasyClass {
	public partial class NewTaskForm : Form {
		Controller controller;
		public NewTaskForm(Controller c) {
			controller = c;

			//system initialization
			InitializeComponent();
			AcceptButton = button1;
		}

		private void NewTaskForm_Load(object sender, EventArgs e) {

		}

		private void button1_Click(object sender, EventArgs e) {
			if (!controller.AddTask(textBox1.Text))
				MessageBox.Show("Task name exists!");
			else
				Close();
		}

		private void textBox1_KeyUp(object sender, KeyEventArgs e) {
			/*
			 if (e.KeyCode == Keys.Enter) {
				controller.AddTask(textBox1.Text);
				Close();
			}
			 */
		}

		private void button2_Click(object sender, EventArgs e) {
			Close();
		}
	}
}
